﻿namespace 中间件1
{
    public class Test2Middleware
    {
        private readonly RequestDelegate _next;
        public Test2Middleware(RequestDelegate next,IConfiguration configuration) //构造函数注入
        {
            _next = next;
            Console.WriteLine(configuration["Logging:LogLevel:Default"]);
           
        }

        public async Task InvokeAsync(HttpContext context,IWebHostEnvironment webHost) //InvokeAsync可以注入
        {
            await context.Response.WriteAsync(webHost.EnvironmentName+"<br/>");
            await _next(context);
            await context.Response.WriteAsync(webHost.ContentRootPath+"<br/>");

        }

    }
}
